/*
 * @Description:
 * @Version: 1.0
 * @Author: 琴时
 * @Date: 2021-11-24 09:16:28
 * @LastEditors: 琴时
 * @LastEditTime: 2021-11-24 16:04:31
 * @FilePath: \pt-utils\ts\a.ts
 */
let num: number = 0
let str: string = '琴时'
let flag: boolean = true
let un: undefined
let nu: null = null
console.log('测试:', ++num)

let fn: Function = (params: number) => {}
flag = fn(3, 2)
un && console.log('测试:', num, str, flag, un, nu)
console.log('测试:', !un && nu)

for (let i: number = 0; i < 2; i++) {
  console.log('测试:',i)
}
let arr: string[] = ['1', '2', '3']
arr[5] = '5'

console.log('测试:', arr[6])

function Fn(a: any, b: number) {
  console.log('测试:', a, b)
}

console.log('测试:', Fn(1, 2))

let person: {
  say1: () => void
  say2: () => number
}

person = {
  say1: function () {
    console.log('测试:', 333)
  },
  say2: function () {
    return 1
  },
}

person.say1()
console.log('测试:', person.say2())

/* 创建接口 */
interface User {
  name: string
  age: number
  sayHi: () => void
}

/* 接口使用 */
let p1: User = {
  name: '琴时',
  age: 18,
  sayHi: function () {
    console.log('测试:', 666)
  },
}
p1.sayHi()

let nn
nn='2'
console.log('测试:',nn)